﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class OnScrollbarEvent : MonoBehaviour
{

    public string onValueChange = "";
    private Scrollbar scrollbar = null;

    void Start()
    {
        this.scrollbar = this.gameObject.GetComponent<Scrollbar>();
        if (this.scrollbar != null) {
            this.scrollbar.onValueChanged.AddListener(valueChanged);
        }
    }

    void Update()
    {

    }

    void valueChanged(float value)
    {
        MonoBehaviour.print("on scrollbar value change value:" + value);
        if (this.onValueChange != "")
        {
            LuaHelper.getLuaModule().callScript(onValueChange, value);
        }
    }
}
